
<template>
  <div>
    <avue-crud
      ref="crud"
      :page="page"
      :data="tableData1"
      :table-loading="tableLoading"
      :option="tableOption"
      @on-load="getList"
    >
      <template
        slot="errMsg"
        slot-scope="scope"
      >
        <span style="color: red">{{scope.row.errMsg}}</span>
      </template>
    </avue-crud>
    <div style="text-align: center; margin: 40px">
      <el-button @click="$emit('close')">返 回</el-button>
    </div>
  </div>
</template>

<script>
import { getQuerySwCkStationDailyReport } from '@/api/rca/swckstationdailyreportadjustquery'
import { previewTableOption, prefixInteger } from '@/const/crud/rca/viewswckstationdailyreportadjustquery'
import { dateFormat } from '@/util/date'
import { mapGetters } from "vuex";

export default {
  name: "TempData",
  data () {
    return {
      searchForm: {},
      tableData1: [],
      page: {
        total: 0, // 总页数
        currentPage: 1, // 当前页数
        pageSize: 20, // 每页显示多少条
      },
      tableOption: previewTableOption,

      tableLoading: false,

      uploading: false,
    };
  },
  props: ["query"],
  created () {

    this.page.currentPage = 1
    this.getList(this.page);
  },
  methods: {
    getList (page, params) {
      this.tableLoading = true;
      const { lineCode } = this.query;
      getQuerySwCkStationDailyReport({
        ...this.query,
        lineCode: lineCode
      })
        .then((response) => {
          this.tableData1 = response.data.data.map(item=>({
          ...item,
          lineCode: item.lineCode.replace(/^0./, "")
        }))
          this.tableLoading = false;
        })
        .catch(() => {
          this.tableLoading = false;
        });
    },
  },
};
</script>
